﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master"  AutoEventWireup="true" CodeBehind="ACM_Inbox.aspx.cs" Inherits="KPIS.GERP.GAMS.APP.App_UI.Forms.ACM_Inbox" %>
<%@ Register src="../UserControls/DatePicker.ascx" tagname="DatePicker" tagprefix="uc1" %>
 <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>รายการ</title>
    <link href="../CssClass.css" rel="stylesheet" type="text/css" />
    <script src="scripts.js" type="text/javascript"></script>
    <script language="JavaScript" src="../Scripts/DatePicker.js" type="text/jscript"></script>
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <style type="text/css">
            .orderText
            {
                font: normal 12px Arial,Verdana;
                margin-top: 6px;
            }

        </style>
    </telerik:RadCodeBlock>
</asp:Content>
    
<asp:Content  runat="server" ID="Content2"  contentplaceholderid="ContentPlaceHolder1" >
     
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function ShowEditForm(id, rowIndex) {
                var grid = $find("<%= grdACMAccountAuto.ClientID %>");

                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);
              
                radopen("App_UI/Forms/ACM_Edit_Inbox.aspx?asset_id=" + id);
                return false;
            }
            function ShowInsertForm() {
                window.radopen("App_UI/Forms/ACM_Edit_Inbox.aspx", "UserListDialog");
                return false;
            }
            function refreshGrid(arg) {
                if (!arg) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
                else {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                }
            }
            function RowDblClick(sender, eventArgs) {
                window.radopen("ACM_Edit_Inbox.aspx?asset_id=" + eventArgs.getDataKeyValue("asset_id"), "POP" );
            }

            function confirmAspButton(button) {
                function aspButtonCallbackFn(arg) {
                    if (arg) {
                        __doPostBack(button.name, "");
                    }
                    else {
                        __doPostBack(button.name, "False");
                    }
                }
                radconfirm("คุณต้องการบันทึกค่าเสื่อมที่คำนวณแล้วหรือไม่?", aspButtonCallbackFn, 330, 180, null, "Confirm");
            }
        </script>
    </telerik:RadCodeBlock>
  
    <telerik:RadWindowManager 
        ID="RadWindowManager1" 
        ShowContentDuringLoad="false" 
        VisibleStatusbar="false" 
        ReloadOnShow="true" 
        runat="server" 
        Skin="Web20" 
        Modal="true" 
        KeepInScreenBounds="true" 
        Style="z-index: 7000">
        <Windows>
            <telerik:RadWindow 
                ID="POP" 
                runat="server" 
                Width="1000px" Height='500px'
                Behaviors="Reload, Close"  >
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Panel2" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Panel2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Panel2" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            </AjaxSettings>
    </telerik:RadAjaxManager>
  
    
   
    <asp:Panel ID="Panel1" runat="server">
        <table align ="center">
            <tr>
                <td>
                    <div class="TextHeader">
                        ค่าเสื่อม
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <telerik:RadGrid ID="grdACMAccountAuto" runat="server" AutoGenerateColumns="false"
                        AllowMultiRowEdit="false" AllowMultiRowSelection="true" 
                        Width="990px" Height="300px" AllowPaging="true" AllowFilteringByColumn="false"
                        GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
                        GroupingSettings-GroupContinuedFormatString=""
                        GroupingSettings-GroupContinuesFormatString=""
                        GroupingSettings-GroupSplitFormat=""
                        OnNeedDataSource="grdACMVersion_NeedDataSource" 
                        align ="center">
                        <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" GroupLoadMode="Client" Width="100%"
                            DataKeyNames="AssetId" ClientDataKeyNames="AssetId" GroupsDefaultExpanded="true">
                            <Columns>
                                <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="TemplateEditColumn" HeaderText="" HeaderStyle-Width="30px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"> 
                                    <ItemTemplate>
                                        <asp:ImageButton ID="cmdEdit" runat="server" CommandName="DataEdit"
                                            ImageUrl="~/App_UI/Images/Buttons/Search.png" 
                                            ToolTip="แก้ไขรายการ" width="17" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="AssetId" HeaderText="AssetId" Visible="false"
                                    SortExpression="AssetId" UniqueName="AssetId">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AssetCode" 
                                    HeaderText="รหัสพัสดุ" 
                                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="150px"
                                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AssetName"
                                    HeaderText="ชื่อพัสดุ"
                                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="SerialNumber" 
                                    HeaderText="Serial Number"
                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" HeaderStyle-Width="150px"
                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AssetDate" DataFormatString = "{0:D}"
                                    HeaderText="วันที่รับเข้าคลัง"
                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" HeaderStyle-Width="150px"
                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                               
                                <telerik:GridBoundColumn DataField="Price" DataFormatString = "{0:n2}"
                                    HeaderText="ราคาเมื่อรับเข้าคลัง"
                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" HeaderStyle-Width="150px"
                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AccumDepreAmount"
                                    HeaderText="ค่าเสื่อมสะสม"
                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" HeaderStyle-Width="150px" DataFormatString = "{0:n2}"
                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                                FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                                NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                                PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                        </MasterTableView>
                        <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
                            GroupContinuedFormatString="" GroupContinuesFormatString="" 
                            GroupSplitFormat="" />
                        <ClientSettings EnableRowHoverStyle="True">
                            <Selecting AllowRowSelect="true" />
                            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                            <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
                        </ClientSettings>
                    </telerik:RadGrid>
                </td>
            </tr>
        </table>

        <div class="DivBody">
            <table align="center">
                <tr>
                    
                    <td align="right" width="150px">
                        ปีที่คิดคำนวณ :
                    </td>
                    <td align="left">
                        <telerik:RadNumericTextBox ID="txtBgmYear" runat="server"
                            MaxLength="4" MinValue="2500" MaxValue="2600"
                            NumberFormat-DecimalDigits="0" NumberFormat-GroupSizes="5" 
                            ShowSpinButtons="true" Type="Number" />
                    </td>
                    <td align="right" width="150px">
                        เดือนที่คิดคำนวณ :
                    </td>
                    <td align="left" width="300px">
                        <telerik:RadComboBox ID="ddlBgmMonth" runat="server"
                            DataTextField="bgm_BgmMonth_Name" DataValueField="bgm_BgmMonth_Id"
                            Filter="Contains" Width="280px">
                        </telerik:RadComboBox>
                    </td>
                        <td>
                        <asp:Button ID="cmdFilter" runat="server" Text="คำนวณค่าเสื่อมราคา" OnClick="cmdFilter_Click" OnClientClick="confirmAspButton(this); return false;"> </asp:Button>
                    </td>
                </tr>
            </table>
        </div>
        <%--<br />
        <div align="center" class="DivInfo">
            <asp:LinkButton ID="btnSave" runat="server" CausesValidation="true" CssClass="LinkButton" onclick="btnSave_Click">บันทึกบัญชี
            </asp:LinkButton>
        </div> --%>   
    </asp:Panel>
      
 
</asp:Content>


